<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<base href="<%=basePath%>">
		<meta charset="UTF-8">
		<title>设备列表</title>
		<link rel="stylesheet" type="text/css" href="<%=basePath %>css/style.css"/>
		<link rel="stylesheet" type="text/css" href="<%=basePath %>css/list.css"/>
		<link rel="stylesheet" type="text/css" href="<%=basePath %>css/jquery.page.css"/>
	</head>
	<body>
		<!-- 蓝色背景区域 -->
		<div class="wrap">
			<!-- 白色可用区域 -->
			<div class="canuse">
				<!------ 位置 ------>
	            <p class="contentText local"><span>位置：设备管理</span></p>
	            
            	<!-- 搜索区 -->
	            <div class="search_area">
                    <h4 class="sel_title"><img src="<%=basePath %>img/list/brand1.png" /><span>设备查询条件</span></h4>
                    <div class="select_area">
                        <div class="select_text clear">
                        	<div class="label_input">
	                            <label class="contentText">设备名称：</label> 
	                            <input type="text" name="deviceName" id="">
                        	</div>
							<div class="label_input">
	                            <label class="contentText">仓库：</label> 
	                            <input type="text" name="storeName" id="">
                        	</div>
                            <div class="floatLeft">
	                            <button class="search bgd_blue_search">查询</button>
	                            <button class="btn_clear bgd_white_clear">重置</button>
                            </div>
                        </div>
                    </div>
	            </div>
	            
	            <!-- 列表区 -->
	            <div class="show_list">
                	<div class="title_operate">
                    	<h4 class="sel_title"><img src="<%=basePath %>img/list/brand1.png" /><span>设备列表</span></h4>
                		
                        <!-- 操作类型区 -->
                        <div class="operate_area">
                            <a onclick="DeviceManagement.toAddDeviceJsp()" class="bgd_add img_hand">增加</a> 
                            <a onclick="DeviceManagement.deleteDevices()" class="bgd_delete img_hand">删除</a> 
                        </div>
                	</div>
                	<div class="list_area">
                        <!-- 信息列表区 -->
                        <div class="info_area">
                            <table class="tablelist" border="1" cellspacing="0" cellpadding="0">
                                <tbody>
                                    <tr class="menuText list_head">
                                        <th class="checkSelectAll"></th>
                                        <th class="">设备名称</th>
                                        <th class="">仓库</th>
                                        <th class="">类型</th>
                                        <th class="">IP地址</th>
                                        <th class="">端口号</th>
                                    </tr>
                                </tbody>
                                <tbody class="tablelist" id="tableList"></tbody>

                            </table>
                        </div>
	                    <!-- 页码区域 -->
	                    <div class="pager contentText clear"></div>
                    </div>
                </div>
			</div>
			
			<!-- 版尾  -->
			<div class="ending">
				Copyright© 2019-2020 磐基技术有限公司
			</div>
			
			<!-- 等待加载 -->
			<!--<div class="loader"><p class="load_hint">请等待加载••••••</p></div>-->
			
		</div>
	</body>
	<script src="<%=basePath %>js/3rd/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=basePath %>js/3rd/jquery.page.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=basePath %>js/common/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=basePath %>js/frame/common.js" type="text/javascript" charset="utf-8"></script>
	<script src="<%=basePath %>js/deviceManagement/deviceList.js" type="text/javascript" charset="utf-8"></script>
	<script type="text/javascript">
		var h = document.documentElement.clientHeight;
		$(".wrap").css("height", h);
		var basePath = "<%=basePath%>";
		// 获取每行 td 的兄弟节点
		$("td").hover(   
			function () {      
				$(this).parent().children().addClass("td_hover");   
			},    
			function () {      
				$(this).parent().children().removeClass("td_hover");   
			}
		);
		
		
		//删除规则
	    function delUserGroup() {
			
	        var list = [];
	        var checks = $("input[name='ids']:checked");
	        $.each(checks, function(index, obj) {
	            list.push(obj.id);
	        });
	        if (!list.length > 0) {
	            alert("请选择要删除的内容");
	            return;
	        }
	        if (!confirm("确定要删除所选记录吗？")) {
				var node = $("input[name='ids']:checked").parents(".list_list");
				node.hide();
	            return;
	        }
	        alert("提醒:删除时，正在使用的用户组将无法删除！");
	        $.ajax({
	            type : 'POST',
	            url : 'userGroup/delUserGroup',
	            data : JSON.stringify(list),
	            contentType : 'application/json; charset=utf-8',
	            async : true,
	            cache : false,
	            success : function(data) {
	                alert(data == 'success' ? "删除成功" : "被使用：无法删除!!!");
	                if (data != 'success') {
	                    return;
	                }
	
	                var current = PageUtils._currentPage['userGroupPage'];
	                PageUtils.pageClick(current, 'userGroupPage');
	            }
	
	        });
	    }
	</script>
</html>
